from marshmallow import Schema, fields
class BfUserSchema(Schema):
    # __bind_key__ = 'jys'
    id=fields.Int()
    username=fields.Str()
    mobile=fields.Str()
    mobiletime=fields.Int()
    password=fields.Str()
    tpwdsetting=fields.Str()
    paypassword=fields.Str()
    invit_1=fields.Str()
    invit_2=fields.Str()
    invit_3=fields.Str()
    truename=fields.Str()
    idcard=fields.Str()
    logins=fields.Int()
    ga=fields.Str()
    addip=fields.Str()
    addr=fields.Str()
    sort=fields.Int()
    addtime=fields.Int()
    endtime=fields.Int()
    status=fields.Int()
    email=fields.Str()
    alipay=fields.Str()
    invit=fields.Str()
    token=fields.Str()
    mibao_question=fields.Str()
    mibao_answer=fields.Str()
    zhengjian=fields.Str()
    idcard_zheng=fields.Str()
    idcard_fan=fields.Str()
    findpwd_mibao=fields.Int()
    findpaypwd_mibao=fields.Int()
    is_agree=fields.Int()
    idcard_shouchi=fields.Str()
    ethpassword=fields.Str()
    etcpassword=fields.Str()
    pwd_err=fields.Str()
    #相当于DECIMAL（10,8）
    # buy_sum=db.Column(db.Numeric(precision=8, asdecimal=False, decimal_return_scale=None),default=0,comment='买入数量')
    buy_sum=fields.Decimal()
    sell_sum = fields.Decimal()
    cpcprize_sum=fields.Int()
    trade_sum=fields.Decimal()
    gjcode=fields.Int()
    enname=fields.Str()
    headimg=fields.Str()
    goodnum=fields.Int()
    goodcomm=fields.Int()
    jianjie=fields.Str()
    history=fields.Str()
    sftime_sum=fields.Int()
    first_trade_time=fields.Int()
    transact=fields.Int()
    xinren=fields.Str()
    pingbi=fields.Str()
    ixinren=fields.Str()
    ipingbi=fields.Str()
    trade_id=fields.Str()
    grade=fields.Int()
    cpcpassword=fields.Str()
    marketid=fields.Str()
    socket_token=fields.Str()
    login_time=fields.Int()
    # user_coin = db.relationship('BfUserCoin', backref='user',
    #                             lazy='dynamic')
    # b_invit = db.relationship('BfInvit', backref='invit_user',
    #                             lazy='dynamic')
    #
    # user_coin = db.relationship('BfUserCoin', backref='coin_user',uselist=False)



class BfUserCoinSchema(Schema):
    __bind_key__ = 'jys'
    __tablename__='bf_user_coin'
    id=fields.Int()
    userid=fields.Int()
    btc = fields.Decimal()
    btcd = fields.Decimal()
    btcb = fields.Str()
    ltc = fields.Decimal()
    ltcd = fields.Decimal()
    ltcb = fields.Str()
    eth = fields.Decimal()
    ethd = fields.Decimal()
    ethb =fields.Str()
    cusd = fields.Decimal()
    cusdd = fields.Decimal()
    usdt = fields.Decimal()
    usdtd = fields.Decimal()
    usdtb = fields.Str()
    bch = fields.Decimal()
    bchd = fields.Decimal()
    bchb =fields.Str()

class TwMyzrSchema(Schema):
    __bind_key__ = 'jys'
    __tablename__ = 'tw_myzr'
    id = fields.Int()
    user_id =  fields.Int()
    username = fields.Str()
    coinnanme = fields.Str()
    txid = fields.Str()
    num = fields.Decimal()
    mum = fields.Decimal()
    fee = fields.Decimal()
    sort = fields.Int()
    addtime = fields.Int()
    endtime = fields.Int()
    status = fields.Int()
    from_user = fields.Int()